<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <!--[if lt IE 9]>
    <script type="text/javascript" src="lib/html5shiv.js"></script>
    <script type="text/javascript" src="lib/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css"/>
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/H-ui.admin.css"/>
    <link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/skin/default/skin.css" id="skin"/>
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/style.css"/>
    <link rel="stylesheet" href="static/vant/index.css">
    <link rel="stylesheet" href="static/element/index.css">
    <!--[if IE 6]>
    <script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js"></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <title>Title</title>
</head>
<body>
<article class="page-container" id="app">
    <table style="table-layout:fixed; width: 100%; word-break:break-all;" class="table table-border table-bordered table-bg table-hover table-sort table-responsive" id="tablelist">
        <tbody id="datalist">
        <tr class="text-c">
            <td style="width: 100px; font-weight: bolder; font-size: 0.8rem; background: #eee;">组织编号</td>
            <td style="font-size: 0.8rem;">
                <input type="text" class="input-text" style="border:0;" ref="bcode" readonly="readonly" id="bcode" autocomplete="off">
            </td>
            <td style="width: 100px; font-weight: bolder; font-size: 0.8rem; background: #eee;">组织名称</td>
            <td style="font-size: 0.8rem;">
                <input type="text" class="input-text" style="border:0;" ref="bname" readonly="readonly" id="bname" autocomplete="off">
            </td>
        </tr>
        <tr class="text-c">
            <td style="width: 100px; font-weight: bolder; font-size: 0.8rem; background: #eee;">部门编号</td>
            <td style="font-size: 0.8rem;">
                <input type="text" class="input-text" style="border:0; color:#aaa;" readonly="readonly" ref="bmbh" id="bmbh" autocomplete="off">
            </td>
            <td style="width: 100px; font-weight: bolder; font-size: 0.8rem; background: #eee;">部门名称</td>
            <td style="font-size: 0.8rem;">
                <input type="text" class="input-text" style="border:0;" ref="bmmc" id="bmmc" autocomplete="off">
            </td>
        </tr>
        <tr class="text-c">
            <td style="width: 100px; font-weight: bolder; font-size: 0.8rem; background: #eee;">排序号</td>
            <td style="font-size: 0.8rem;">
                <el-input @input="fzr=fzr.replace(/\D+/g,'')" v-model="fzr" ref="fzr" id="fzr" placeholder="请输入排序号" type="text" style="font-size: 18px"></el-input>
            </td>
            <td style="width: 100px; font-weight: bolder; font-size: 0.8rem; background: #eee;">消费类别</td>
            <td style="font-size: 0.8rem;">
                <label>
                    <select id="xflx" style="width: 100%; font-size: 0.8rem; border: 0">
                    </select>
                </label>
            </td>
        </tr>
        <tr class="text-c">
            <td style="width: 100px; font-weight: bolder; font-size: 0.8rem; background: #eee;"></td>
            <td style="font-size: 0.8rem;">
                <input type="text" class="input-text" style="width:0; border:0;" ref="VALUE08" id="VALUE08" disabled="disabled">
            </td>
            <td style="width: 100px; font-weight: bolder; font-size: 0.8rem; background: #eee;"></td>
            <td style="font-size: 0.8rem;">
            </td>
        </tr>
        <tr class="text-c">
            <td style="width: 100px; font-weight: bolder; font-size: 0.8rem; background: #eee;"></td>
            <td style="font-size: 0.8rem;">
                <input type="text" class="input-text" style="width:0; border:0;" ref="VALUE09" id="VALUE09" autocomplete="off" disabled="disabled">
            </td>
            <td style="width: 100px; font-weight: bolder; font-size: 0.8rem; background: #eee;"></td>
            <td style="font-size: 0.8rem;">
                <div style="text-align: left">
                </div>
            </td>
        </tr>
        <tr class="text-c" v-show="flag">
            <td style="width: 100px; font-weight: bolder; font-size: 0.8rem; background: #eee;">操作员号</td>
            <td style="font-size: 0.8rem;">
                <input type="text" class="input-text" style="border:0;" ref="opid" id="opid" autocomplete="off">
            </td>
            <td style="width: 100px; font-weight: bolder; font-size: 0.8rem; background: #eee;">什么操作</td>
            <td style="font-size: 0.8rem;">
                <input type="text" class="input-text" style="border:0;" ref="do" id="do" autocomplete="off">
                <%--INSERT UPDATE--%>
            </td>
            <td style="width: 100px; font-weight: bolder; font-size: 0.8rem; background: #eee;">系统唯一序号</td>
            <td style="font-size: 0.8rem;">
                <input type="text" class="input-text" style="border:0;" ref="lid" id="lid" autocomplete="off">
            </td>
        </tr>
        </tbody>
    </table>
    <van-row style="margin-top: 25px;">
        <van-col span="6"></van-col>
        <van-col span="6"></van-col>
        <van-col span="6">
            <div style="text-align: right">
                <van-button type="primary" @click="fDo()" style="width: 80%">提交</van-button>
            </div>
        </van-col>
        <van-col span="6">
            <div style="text-align: right">
                <van-button type="info" @click="fExit()" style="width: 80%">返回</van-button>
            </div>
        </van-col>
    </van-row>
</article>

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript" src="static/axios.min.js"></script>
<script type="text/javascript" src="./static/vue"></script>
<script src="static/vant/vant.min.js"></script>
<script src="static/element/index.js"></script>
<script type="text/javascript">

    let vm = new Vue({
        el: '#app',
        data: {
            flag: false,
            fzr:''
        },
        methods: {
            fDo() {
                if (this.$refs.bmbh.value.length === 0) {
                    layer.msg('请输入部门编号!', {icon: 0, time: 2000});
                    return
                }

                if (this.fzr.length === 0) {
                    layer.msg('请输入排序号!', {icon: 0, time: 2000});
                    return
                }

                if (this.$refs.bmmc.value.length === 0) {
                    layer.msg('请输入部门名称!', {icon: 0, time: 2000});
                    return
                }

                let ls_xflxid = $("#xflx option:selected").val()
                if (ls_xflxid.length === 0) {
                    layer.msg('请选择消费类型!', {icon: 0, time: 2000});
                    return
                }
                let params = new URLSearchParams();
                params.append('CMD', "ZL");
                params.append('VALUE01', this.$refs.bcode.value);           //--上级公司编号
                params.append('VALUE02', this.$refs.bmbh.value);            //--部门显示编号
                params.append('VALUE03', this.$refs.bmmc.value);            //--部门名称
                params.append('VALUE04', this.fzr);             //--负责人
                params.append('VALUE05', ls_xflxid);                        //--消费类型
                params.append('VALUE14', this.$refs.do.value);              //--何种操作
                params.append('VALUE15', this.$refs.opid.value);            //--操作员编号

                axios.post('/f_wscl/com2', params)
                    .then(function (res) {
                        let {db1} = res.data
                        if (db1[0].VALUE01 === 'ZZ01') {
                            layer.msg(db1[0].VALUE02, {icon: 0, time: 2000});
                        } else if (db1[0].VALUE01 === 'ZZ00') {
                            layer.msg('数据库操作完毕!', {icon: 1, time: 1500}, function () {
                                let index = parent.layer.getFrameIndex(window.name);
                                parent.fwGetinfo();
                                parent.layer.close(index);
                            });
                        }
                    })
                    .catch(function (error) {
                        layer.msg('网络异常错误', {icon: 1, time: 1000});
                    });
            },

            fExit() {
                let index = parent.layer.getFrameIndex(window.name);
                parent.layer.close(index);
            }
        }
    })

    $(document).ajaxComplete(function (event, xhr, settings) {
        //从http头信息取出 在filter定义的sessionstatus，判断是否是 timeout
        if (xhr.getResponseHeader("sessionstatus") === "timeout") {
            //从http头信息取出登录的url ＝ loginPath
            if (xhr.getResponseHeader("loginPath")) {
                window.location.replace(xhr.getResponseHeader("loginPath"));
            }
        }
    });
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>
